//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import SotoCore

// MARK: Paginators

extension Budgets {
    ///   Describes a budget action history detail.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeBudgetActionHistoriesPaginator<Result>(
        _ input: DescribeBudgetActionHistoriesRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeBudgetActionHistoriesResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeBudgetActionHistories,
            inputKey: \DescribeBudgetActionHistoriesRequest.nextToken,
            outputKey: \DescribeBudgetActionHistoriesResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeBudgetActionHistoriesPaginator(
        _ input: DescribeBudgetActionHistoriesRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeBudgetActionHistoriesResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeBudgetActionHistories,
            inputKey: \DescribeBudgetActionHistoriesRequest.nextToken,
            outputKey: \DescribeBudgetActionHistoriesResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    ///   Describes all of the budget actions for an account.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeBudgetActionsForAccountPaginator<Result>(
        _ input: DescribeBudgetActionsForAccountRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeBudgetActionsForAccountResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeBudgetActionsForAccount,
            inputKey: \DescribeBudgetActionsForAccountRequest.nextToken,
            outputKey: \DescribeBudgetActionsForAccountResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeBudgetActionsForAccountPaginator(
        _ input: DescribeBudgetActionsForAccountRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeBudgetActionsForAccountResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeBudgetActionsForAccount,
            inputKey: \DescribeBudgetActionsForAccountRequest.nextToken,
            outputKey: \DescribeBudgetActionsForAccountResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    ///   Describes all of the budget actions for a budget.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeBudgetActionsForBudgetPaginator<Result>(
        _ input: DescribeBudgetActionsForBudgetRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeBudgetActionsForBudgetResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeBudgetActionsForBudget,
            inputKey: \DescribeBudgetActionsForBudgetRequest.nextToken,
            outputKey: \DescribeBudgetActionsForBudgetResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeBudgetActionsForBudgetPaginator(
        _ input: DescribeBudgetActionsForBudgetRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeBudgetActionsForBudgetResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeBudgetActionsForBudget,
            inputKey: \DescribeBudgetActionsForBudgetRequest.nextToken,
            outputKey: \DescribeBudgetActionsForBudgetResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    ///  Describes the history for DAILY, MONTHLY, and QUARTERLY budgets. Budget history isn't available for ANNUAL budgets.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeBudgetPerformanceHistoryPaginator<Result>(
        _ input: DescribeBudgetPerformanceHistoryRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeBudgetPerformanceHistoryResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeBudgetPerformanceHistory,
            inputKey: \DescribeBudgetPerformanceHistoryRequest.nextToken,
            outputKey: \DescribeBudgetPerformanceHistoryResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeBudgetPerformanceHistoryPaginator(
        _ input: DescribeBudgetPerformanceHistoryRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeBudgetPerformanceHistoryResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeBudgetPerformanceHistory,
            inputKey: \DescribeBudgetPerformanceHistoryRequest.nextToken,
            outputKey: \DescribeBudgetPerformanceHistoryResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    ///  Lists the budgets that are associated with an account.  The Request Syntax section shows the BudgetLimit syntax. For PlannedBudgetLimits, see the Examples section.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeBudgetsPaginator<Result>(
        _ input: DescribeBudgetsRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeBudgetsResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeBudgets,
            inputKey: \DescribeBudgetsRequest.nextToken,
            outputKey: \DescribeBudgetsResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeBudgetsPaginator(
        _ input: DescribeBudgetsRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeBudgetsResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeBudgets,
            inputKey: \DescribeBudgetsRequest.nextToken,
            outputKey: \DescribeBudgetsResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    ///  Lists the notifications that are associated with a budget.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeNotificationsForBudgetPaginator<Result>(
        _ input: DescribeNotificationsForBudgetRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeNotificationsForBudgetResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeNotificationsForBudget,
            inputKey: \DescribeNotificationsForBudgetRequest.nextToken,
            outputKey: \DescribeNotificationsForBudgetResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeNotificationsForBudgetPaginator(
        _ input: DescribeNotificationsForBudgetRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeNotificationsForBudgetResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeNotificationsForBudget,
            inputKey: \DescribeNotificationsForBudgetRequest.nextToken,
            outputKey: \DescribeNotificationsForBudgetResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    ///  Lists the subscribers that are associated with a notification.
    ///
    /// Provide paginated results to closure `onPage` for it to combine them into one result.
    /// This works in a similar manner to `Array.reduce<Result>(_:_:) -> Result`.
    ///
    /// Parameters:
    ///   - input: Input for request
    ///   - initialValue: The value to use as the initial accumulating value. `initialValue` is passed to `onPage` the first time it is called.
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned
    ///         along with a boolean indicating if the paginate operation should continue.
    public func describeSubscribersForNotificationPaginator<Result>(
        _ input: DescribeSubscribersForNotificationRequest,
        _ initialValue: Result,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (Result, DescribeSubscribersForNotificationResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
    ) -> EventLoopFuture<Result> {
        return client.paginate(
            input: input,
            initialValue: initialValue,
            command: describeSubscribersForNotification,
            inputKey: \DescribeSubscribersForNotificationRequest.nextToken,
            outputKey: \DescribeSubscribersForNotificationResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }

    /// Provide paginated results to closure `onPage`.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    ///   - onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
    public func describeSubscribersForNotificationPaginator(
        _ input: DescribeSubscribersForNotificationRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil,
        onPage: @escaping (DescribeSubscribersForNotificationResponse, EventLoop) -> EventLoopFuture<Bool>
    ) -> EventLoopFuture<Void> {
        return client.paginate(
            input: input,
            command: describeSubscribersForNotification,
            inputKey: \DescribeSubscribersForNotificationRequest.nextToken,
            outputKey: \DescribeSubscribersForNotificationResponse.nextToken,
            on: eventLoop,
            onPage: onPage
        )
    }
}

extension Budgets.DescribeBudgetActionHistoriesRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeBudgetActionHistoriesRequest {
        return .init(
            accountId: self.accountId,
            actionId: self.actionId,
            budgetName: self.budgetName,
            maxResults: self.maxResults,
            nextToken: token,
            timePeriod: self.timePeriod
        )
    }
}

extension Budgets.DescribeBudgetActionsForAccountRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeBudgetActionsForAccountRequest {
        return .init(
            accountId: self.accountId,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension Budgets.DescribeBudgetActionsForBudgetRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeBudgetActionsForBudgetRequest {
        return .init(
            accountId: self.accountId,
            budgetName: self.budgetName,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension Budgets.DescribeBudgetPerformanceHistoryRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeBudgetPerformanceHistoryRequest {
        return .init(
            accountId: self.accountId,
            budgetName: self.budgetName,
            maxResults: self.maxResults,
            nextToken: token,
            timePeriod: self.timePeriod
        )
    }
}

extension Budgets.DescribeBudgetsRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeBudgetsRequest {
        return .init(
            accountId: self.accountId,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension Budgets.DescribeNotificationsForBudgetRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeNotificationsForBudgetRequest {
        return .init(
            accountId: self.accountId,
            budgetName: self.budgetName,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension Budgets.DescribeSubscribersForNotificationRequest: AWSPaginateToken {
    public func usingPaginationToken(_ token: String) -> Budgets.DescribeSubscribersForNotificationRequest {
        return .init(
            accountId: self.accountId,
            budgetName: self.budgetName,
            maxResults: self.maxResults,
            nextToken: token,
            notification: self.notification
        )
    }
}
